<?php
/**
 * This file is form http://findcat.cn
 *
 * @link     https://findcat.cn
 * @email    1476982312@qq.com
 */
namespace App\Http\Controllers\Home;

use App\Models\Article;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class SearchController extends Controller
{
    public function index(Request $request)
    {
        $data = Article::query()
            ->where('status', true)
            ->where('id','!=', 7)
            ->where('title', 'like', '%' . $request->keyword . '%')
            ->orWhere('content', 'like', '%' . $request->keyword . '%')
            ->orWhere('keywords', 'like', '%' . $request->keyword . '%')
            ->orWhere('description', 'like', '%' . $request->keyword . '%')
            ->get();

        return view('home.index', $data);
    }
}
